Flags can be grouped into four major categories:
Global flags can be set at the command line or in an options file, but cannot be set locally using stylized comments. These flags control on-line help, initialization files, pre-processor flags, libraries and output.
Help
On-line help provides documentation on LCLint operation and flags. When a help flag is used, no checking is done by LCLint. Help flags may be preceded by - or +.
Display general help overview, including list of additional help topics.help <topic>
Display help on <topic>. Available topics:help <flag>
annotations describe annotations comments describe control comments flags summarize flag categories flags <category> all flags pertaining to <category> (one of the categories listed by lclint -help flags) flags alpha all flags in alphabetical order flags full print a full description of all flags print information on mailing lists modes flags settings in modes prefixcodes character codes for setting namespace prefixes references print references to relevant papers and web sites vars describe environment variables version print maintainer and version information
Describe flag <flag>. (May list several flags.)warnflags
Display a warning when a flag is set in a surprising way. An error is reported if an obsolete (LCLint Version 1.4 or earlier) flag is set, a flag is set to its current value (i.e., the + or - may be wrong), or a mode selector flag is set after mode checking flags that will be reset by the mode were set. By default, warnflags is on. To suppress flag warnings, use -warnflags.
These flags control directories and files used by LCLint. They may be used from the command line or in an options file, but may not be used as control comments in the source code. Except where noted. they have the same meaning preceded by - or +.
Set directory for writing temp files. Default is /tmp/.I<directory>
Add directory to path searched for C include files. Note there is no space after the I, to be consistent with C preprocessor flags.S<directory>
Add directory to path search for .lcl specification files.
Load options file <file>. If this flag is used from the command line, the default ~/.lclintrc file is not loaded. This flag may be used in an options file to load in another options file.nof
Prevents the default options files (./.lclintrc and ~/.lclintrc) from being loaded. (Setting -nof overrides +nof, causing the options files to be loaded normally.)systemdirs
Set directories for system files (default is "/usr/include"). Separate directories with colons (e.g., "/usr/include:/usr/local/lib"). Flag settings propagate to files in a system directory. If -systemdirerrors is set, no errors are reported for files in system directories.
These flags are used to define or undefine pre-processor constants. The -I<directory> flag is also passed to the C pre-processor.
Passed to the C pre-processor.U<initializer>
Passed to the C pre-processor
These flags control the creation and use of libraries.
dump <file>
Save state in <file> for loading. The default extension .lcd is added if <file> has no extension.load <file>
Load state from <file> (created by -dump). The default extension .lcd is added if <file> has no extension. Only one library file may be loaded.
By default, the standard library is loaded if the -load flag is not used to load a user library. If no user library is loaded, one of the following flags may be used to select a different standard library. Precede the flag by + to load the described library (or prevent a library from being loaded using nolib). See Apppendix F for information on the provided libraries.
Do not load any library. This prevents the standard library from being loaded.ansi-lib
Use the ANSI standard library (selected by default).strict-lib
Use strict version of the ANSI standard library.posix-lib
Use the POSIX standard library.posix-strict-lib
Use the strict version of the POSIX standard library.unix-lib
Use UNIX version of standard library.unix-strict-lib
Use the strict version of the UNIX standard library.
These flags control what additional information is printed by LCLint. Setting +<flag> causes the described information to be printed; setting -<flag> prevents it. By default, all these flags are off.
Show a summary of all errors reported and suppressed. Counts of suppressed errors are not necessarily correct since turning a flag off may prevent some checking from being done to save computation, and errors that are not reported may propagate differently from when they are reported.showscan
Show file names are they are processed.showalluses
Show list of uses of all external identifiers sorted by number of uses.stats
Display number of lines processed and checking time.timedist
Display distribution of where checking time is spent.quiet
Suppress herald and error count. (If quiet is not set, LCLint prints out a herald with version information before checking begins, and a line summarizing the total number of errors reported.)whichlib
Print out the standard library filename and creation information.limit <number>
At most <number> similar errors are reported consecutively. Further errors are suppressed, and a message showing the number of suppressed messages is printed.
Normally, LCLint will expect to report no errors. The exit status will be success (0) if no errors are reported, and failure if any errors are reported. Flags can be used to set the expected number of reported errors. Because of the provided error suppression mechanisms, these options should probably not be used for final checking real programs but may be useful in developing programs using make.
expect <number>
Exactly <number> code errors are expected. LCLint will exit with failure exit status unless <number> code errors are detected.
These flags control how messages are printed. They may be set at the command line, in options files, or locally in syntactic comments. The linelen and limit flags may be preceded by + or - with the same meaning; for the other flags, + turns on the describe printing and - turns it off. The box to the left of each flag gives its default value.
Show column number where error is found. Default: +showfunc
Show name of function (or macro) definition containing error. The function name is printed once before the first message detected in that function. Default: +showallconjs
Show all possible alternate types (see Section 8.2.2). Default: -hints
Provide hints describing an error and how a message may be suppressed for the first error reported in each error class. Default: +forcehints
Provide hints for all errors reported, even if the hint has already been displayed for the same error class. Default: -linelen <number>
Set length of maximum message line to <number> characters. LCLint will split messages longer than <number> characters long into multiple lines. Default: 80
Mode selects flags set the mode checking flags to predefined values. They provide a quick coarse-grain way of controlling what classes of errors are reported. Specific checking flags may be set after a mode flag to override the mode settings. Mode flags may be used locally, however the mode settings will override specific command line flag settings. A warning is produced if a mode flag is used after a mode checking flag has been set.
These are brief descriptions to give a general idea of what each mode does. To see the complete flag settings in each mode, use lclint -help modes. A mode flag has the same effect when used with either + or -.
Weak checking, intended for typical unannotated C code. No modifies checking, macro checking, rep exposure, or clean interface checking is done. Return values of type int may be ignored. The types bool, int, char and user-defined enum types are all equivalent. Old style declarations are unreported.standard
The default mode. All checking done by weak, plus modifies checking, global alias checking, use all parameters, using released storage, ignored return values or any type, macro checking, unreachable code, infinite loops, and fall-through cases. The types bool, int and char are distinct. Old style declarations are reported.checks
Moderately strict checking. All checking done by standard, plus must modification checking, rep exposure, return alias, memory management and complete interfaces.strict
Absurdly strict checking. All checking done by checks, plus modifications and global variables used in unspecified functions, strict standard library, and strict typing of C operators. A special reward will be presented to the first person to produce a real program that produces no errors with strict checking.Checking Flags
These flags control checking done by LCLint. They may be set locally using syntactic comments, from the command line, or in an options file. Some flags directly control whether a certain class of message is reported. Preceding the flag by + turns reporting on, and preceding the flag by - turns reporting off. Other flags control checking less directly by determining default values (what annotations are implicit), making types equivalent (to prevent certain type errors), controlling representation access, etc. For these flags, the effect of + is described, and the effect of - is the opposite (or explicitly explained if there is no clear opposite). The organization of this section mirrors Sections 3-10.
Under each flag name is a flag descriptor encoding the what kind of flag it is and its default value. The descriptions are:
A plain flag. The value after the colon gives the default setting (e.g., this flag is off.)m: --++
A mode checking flag. The value of the flag is set by the mode selector. The four signs give the setting in the weak, standard, checks and strict modes. (e.g., this flag is off in the weak and standard modes, and on in the checks and strict modes.)shortcut
A shortcut flag. This flag sets other flags, so it has no default value.
Abstract Types
plain: -
impabstract
Implicit abstract annotation for type declarations that do not use concrete.
Representation of mutable type has sharing semantics.
An abstract type defined in M.h (or specified in M.lcl) is accessible in M.c.
plain: +
accessfile
An abstract type named type is accessible in files named type.<extenstion>.
plain: +
accessczech
An abstract type named type may be accessible in a function named type_name. (see Section 9.1.1)
An abstract type named type may be accessible in a function named typeName. (see Section.9.1.2)
An abstract type named type may be accessible in a function named type_name or typeName. (see Section 9.1.3)
Sets accessmodule, accessfile and accessczech.
These flags control the type name used to represent booleans, and whether the boolean type is abstract.
Boolean type is an abstract type.
plain: bool
booltype <name>
Set name of boolean type to <name>.
plain: FALSE
boolfalse <name>
Set name of boolean false to <name>.
plain: TRUE
booltrue <name>
Set name of boolean true to <name>.
m: --++
predboolptr
Type of condition test is a pointer.
m: -+++
predboolint
Type of condition test is an integral type.
m: ++++
predboolothers
Type of condition test is not a boolean, pointer or integral type.
Sets predboolint, predboolptr and preboolothers.
plain: +
predassign
Arithmetic involving pointer and integer.
Allow the operand of the ! operator to be a pointer.
Primitive operation does not type check strictly.
m: ---+
sizeoftype
plain: +
formatcode
Invalid format code in format string for printflike or scanflike function.
plain: +
formattype
Type-mismatch in parameter corresponding to format code in a printflike or scanflike function.
m: -+++
boolcompare
Comparison between boolean values. This is dangerous since there may be multiple TRUE values if any non-zero value is interpreted at TRUE.
m: -+++
realcompare
m: -+++
ptrcompare
Comparison between pointer and number.
m: +---
voidabstract
Allow void * to match pointers to abstract types. (Casting a pointer to an abstract type to a pointer to void is okay if +voidabstract is set.)
plain: +
castfcnptr
A pointer to a function is cast to (or used as) a pointer to void (or vice versa).
m: +---
forwarddecl
Forward declarations of pointers to abstract representation match abstract type.
Allow members of enum type to index arrays.
Make char and int types equivalent.
Make enum and int types equivalent.
m: ----
ignorequals
Ignore type qualifiers (long, short, unsigned).
m: ++--
relaxquals
m: ----
ignoresigns
Ignore signs in type comparisons (unsigned matches signed).
Allow long type to match an arbitrary integral type (e.g., size_t).
m: +---
longunsignedintegral
Allow long unsigned type to match an arbitrary integral type (e.g., dev_t).
Allow any integral type to match an arbitrary integral type (e.g., dev_t).
m: +---
long-unsigned-unsigned-integral
Allow unsigned long type to match an arbitrary unsigned integral type (e.g., size_t).
m: +---
long-signed-integral
Allow long type to match an arbitrary signed integral type (e.g., ssize_t).
m: ++++Integer literals can be used as floats.
A character constant may be used as an int.
Literal 0 may be used as a pointer.
m: ----
relaxtypes
Allow all numeric types to match.
Initializer does not set every field in the structure.
Modification (Section 4.1)
Undocumented modification of caller-visible state. Without +moduncon, modification errors are only reported in the definitions of functions declared with a modifies clause (or specified).
Report modification errors in functions declared without a modifies clause.(Sets modnomods, mod-globs-nomods and mod-strict-globs-nomods.)
m: ---+
mod-nomods
m: ---+
mod-uncon-nomods
m: ---+
mod-internal-strict
m: ---+
mod-file-sys
A function modifies the file system but does not list fileSystem in its modifies clause.
Global Variables (Section 4.2)
Errors involving the use and modification of global and file static variables are reported depending on flag settings, annotations where the global variable is declared, and whether or not the function where the global is used was declared with a globals clause.
Undocumented use of a checked global variable in a function with a globals list.
A global listed in the globals list is not used in the implementation.
m: ---+
globnoglobs
Use of a checked global in a function with no globals list.
m: ---+
internalglobs
Undocumented use of internal state (should have globals internalState).
m: ---+
internalglobsnoglobs
Use of internal state in function with no globals list.
A function returns with global in inconsistent state (null or undefined)
Report use and modification errors for globals not annotated with unchecked.
m: ++++
checkstrictglobs
Report use and modification errors for checkedstrict globals.
Modification of Global Variables
Undocumented modification of a checked global variable.
m: ---+
modglobsunchecked
Undocumented modification of an unchecked global variable.
m: ---+
modglobsnomods
Undocumented modification of a checked global variable in a function with no modifies clause.
m: ---+
modstrictglobsnomods
Globals Lists and Modifies Clauses
m: ---+
warnmissingglobs
m: ---+
warnmissingglobsnoglobs
Global variable used in modifies clause of a function with no globals list.
m: --++
globsimpmodsnothing
A function declared with a globals list but no modifies clause is assumed to modify nothing.
m: ----
modsimpnoglobs
A function declared with a modifies clause but no globals list is assumed to use no globals.
m: ----
impcheckedglobs
Implicit checked qualifier on global variables with no checking annotation.
m: ----
impcheckedstatics
Implicit checked qualifier file static scope variables with no checking annotation.
m: ----
impcheckmodglobs
Implicit checkmod qualifier on global variables with no checking annotation.
m: ----
impcheckmodstatics
Implicit checkmod qualifier file static scope variables with no checking annotation.
m: ---+
impcheckedstrictglobs
Implicit checked qualifier on global variables with no checking annotation.
m: ---+
impcheckedstrictstatics
Implicit checked qualifier file static scope variables with no checking annotation.
m: --++
impcheckmodinternals
Implicit checkmod qualifier on function scope static variables with no checking annotation.
m: -+++
impglobsweak
Function returns with global aliasing external state (sets checkstrictglobalias, checkedglobalias, checkmodglobalias and uncheckedglobalias).
m: -+++
checkstrictglobalias
Function returns with a checkstrict global aliasing external state.
m: -+++
checkedglobalias
Function returns with a checked global aliasing external state.
m: -+++
checkmodglobalias
Function returns with a checkmod global aliasing external state.
m: --++
uncheckedglobalias
Function returns with an unchecked global aliasing external state.
Declaration Consistency (Section 4.3)
Identifier redeclared or redefined with inconsistent type.
m: -+++
incondefslib
Identifier defined in a library is redefined with inconsistent type
Standard library function overloaded.
m: -+++
matchfields
A struct or enum type is redefined with inconsistent fields or members.
Reporting of memory management errors is controlled by flags setting checking and implicit annotations and code annotations.
Deallocation Errors (Section 5.2)
m: -+++
usereleased
Storage used after it may have been released.
m: ---+
strictusereleased
An array element used after it may have been released.
m: -+++
branchstate
m: ---+
strictbranchstate
m: -+++
compdestroy
m: ---+
strictdestroy
Sets all memory transfer errors flags.
Only storage transferred to non-only reference (memory leak).
m: -+++
ownedtrans
Owned storage transferred to non-owned reference (memory leak).
m: -+++
freshtrans
Newly-allocated storage transferred to non-only reference (memory leak).
m: -+++
sharedtrans
Shared storage transferred to non-shared reference.
m: -+++
dependenttrans
Inconsistent dependent transfer. Dependent storage is transferred to a non-dependent reference.
Kept storage transferred to non-temporary reference.
Keep storage is transferred in a way that may add a new alias to it, or release it.
m: -+++
refcounttrans
Reference counted storage is transferred in an inconsistent way.
m: -+++
newreftrans
A new reference transferred to a reference counted reference (reference count is not set correctly).
m: -+++
immediatetrans
An immediate address (result of &) is transferred inconsistently.
m: -+++
statictrans
Static storage is transferred in an inconsistent way.
m: -+++
exposetrans
m: -+++
observertrans
Inconsistent observer transfer. Observer storage is transferred to a non-observer reference.
m: -+++
unqualifiedtrans
Unqualified storage is transferred in an inconsistent way.
m: --++
onlyunqglobaltrans
m: --++
staticinittrans
Static storage is used as an initial value in an inconsistent way.
m: --++
unqualifiedinittrans
Unqualified storage is used as an initial value in an inconsistent way.
m: -+++
compmempass
Storage derivable from a parameter does not match the alias kind expected for the formal parameter.
A stack reference is pointed to by an external reference when the function returns. Since the call frame will be destroyed when the function returns the return value will point to dead storage. (Section 5.2.6)
Implicit Memory Annotations (Section 5.3)
plain: +
globimponly
Assume unannotated global storage is only.
Assume unannotated parameter is temp.
plain: +
retimponly
Assume unannotated returned storage is only.
Assume unannotated structure or union field is only.
Sets globimponly, retimponly and structimponly.
Report memory errors for unqualified storage.
m: ----
passunknown
Passing a value as an unannotated parameter clears its annotation. This will prevent many spurious errors from being report for unannotated programs, but eliminates the possibility of detecting many errors.
Aliasing (Section 6)
m: -+++
aliasunique
m: -+++
mayaliasunique
m: -+++
mustnotalias
A function returns an alias to parameter or global.
m: --++
assignexpose
Abstract representation is exposed by an assignment or passed parameter.
m: --++
castexpose
Abstract representation is exposed through a cast.
Abstract representation is exposed by a return value.
plain: +
modobserver
Possible modification of observer storage.
m: ---+
modobserveruncon
Storage declared with observer may be modified through a call to an unconstrained function.
String Literals (Section 6.2.1)
m: --++
readonlytrans
Report memory transfer errors for initializations to read-only string literals
m: -+++
readonlystrings
String literals are read-only (ANSI semantics). An error is reported if a string literal may be modified or released.
Use Before Definition (Section 7.1)
The value of a location that may not be initialized on some execution path is used.
Allow unannotated pointer parameters to functions to be implicit out parameters.
Storage derivable from a parameter, return value or global variable is not completely defined.
No field of a union is defined. (No error is reported if at least one union field is defined.)
m: -+++
mustdefine
Parameter declared with out is not defined before return or scope exit.
A possibly null pointer may be dereferenced.
A possibly null pointer is passed as a parameter not annotated with null.
A possibly null pointer is return as a result not annotated with null.
Possibly null pointer reachable from a reference with no null annotation.
m: -+++
nullassign
Inconsistent assignment or initialization involving null pointer.
These flags control expansion and checking of macro definitions and invocations.
Macro Expansion
These flags control which macros are checked as functions or constants, and which are expanded in the pre-processing phase. Macros preceded by /*@notfunction@*/ are never expanded regardless of these flag settings. These flags may be used in source-file control comments.
Macros defined with parameter lists are not expanded and are checked as functions.
plain: -
constmacros
Macros defined without parameter lists are not expanded and are checked as constants.
Sets allfcnmacros and allconstmacros.
These flags control what errors are reported in macro definitions.
m: -+++
macroparams
A macro parameter is not used exactly once in all possible invocations of the macro.
m: -+++
macroassign
A macro parameter is used as the left side of an assignment expression.
m: -+++
macroparens
A macro parameter is used without parentheses (in potentially dangerous context).
m: ---+
macroempty
Macro definition of a function is empty.
m: -+++
macroredef
Macro is redefined. There is another macro defined with the same name.
m: -+++
macrounrecog
An unrecognized identifier appears in a macro definition. Since the identifier may be defined where the macro is used, this could be okay, but LCLint will not be able to check the unrecognized identifier appropriately.
Corresponding Declarations
m: ++++
macromatchname
A macro definition has no corresponding declaration. (Sets macrofcndecl and macroconstdecl.)
m: -+++
macrofcndecl
m: -+++
macroconstdecl
A macro definition without parameter list has no corresponding constant declaration.
A constant or iter declaration is not immediately followed by a macro definition.
Side-Effect Free Parameters (Section 8.2.1)
These flags control error reporting for parameters with inconsistent side-effects in invocations of checked function macros and function calls.
An actual parameter with side-effects is passed as a formal parameter declared with sef.
An actual parameter involving a call to an unconstrained function (declared without modifies clause) that may modify anything is passed as a sef parameter.
An iterator has been declared with no parameters annotated with yield.
plain: +
namechecks
Turns all name checking on or off without changing other settings.
Type-Based Naming Conventions (Section 9.1)
Czech Naming Convention
Selects complete Czech naming convention (sets accessczech, czechfcns, czechvars, czechconsts, czechmacros, and czechtypes).
plain: +
accessczech
Function or iterator name is not consistent with Czech naming convention.
Variable name is not consistent with Czech naming convention.
plain: -
czechmacros
Expanded macro name is not consistent with Czech naming convention.
plain: -
czechconsts
Constant name is not consistent with Czech naming convention.
plain: -
czechtypes
Selects complete Slovak naming convention (sets accessslovak, slovakfcns, slovakvars, slovakconsts, slovakmacros, and slovaktypes).
plain: -
slovakfcns
Function or iterator name is not consistent with Slovak naming convention.
Expanded macro name is not consistent with Slovak naming convention.
plain: -
slovakvars
Variable name is not consistent with Slovak naming convention.
Constant name is not consistent with Slovak naming convention.
plain: -
slovaktypes
Czechoslovak Naming Convention
Selects complete Czechoslovak naming convention (sets accessczechoslovak, czechoslovakfcns, czechoslovakvars, czechoslovakconsts, czechoslovakmacros, and czechoslovaktypes).
Function name is not consistent with Czechoslovak naming convention.
Expanded macro name is not consistent with Czechoslovak naming convention.
Variable name is not consistent with Czechoslovak naming convention.
Constant name is not consistent with Czechoslovak naming convention.
Namespace Prefixes (Section 9.2)
macrovarprefix <prefix string>
Set namespace prefix for variables declared in a macro body. (Default is m_.)
plain: +
macrovarprefixexclude
A variable declared outside a macro body starts with the macrovarprefix.
Set namespace prefix of struct, union or enum tag identifiers.
An identifier that is not a tag starts with the tagprefix.
Set namespace prefix for enum members.
An identifier that is not an enum member starts with the enumprefix.
filestaticprefix <prefix string>
Set namespace prefix for file static declarations.
plain: -
filestaticprefixexclude
An identifier that is not file static starts with the filestaticprefix.
Set namespace prefix for global variables.
An identifier that is not a global variable starts with the globalprefix.
Set namespace prefix for user-defined types.
An identifier that is not a type name starts with the typeprefix.
externalprefix <prefix string>
Set namespace prefix for external identifiers.
plain: -
externalprefixexclude
An identifier that is not external starts with the externalprefix.
Set namespace prefix for local variables.
An identifier that is not a local variable starts with the localprefix.
uncheckedmacroprefix <prefix string>
Set namespace prefix for unchecked macros.
plain: -
uncheckedmacroprefixexclude
An identifier that is not the name of an unchecked macro starts with the uncheckedmacroprefix.
Set namespace prefix for constants.
An identifier that is not a constant starts with the constantprefix.
Set namespace prefix for iterators.
An identifier that is not a iter starts with the iterprefix.
proto-param-prefix <prefix string>
Set namespace prefix for parameters in function prototypes.
plain: -
proto-param-prefix-exclude
An identifier that is not a parameter in a function prototype starts with the protoprarmprefix.
m: --++
proto-param-name
A parameter in a function prototype has a name (can interfere with macro definitions).
m: ---+
proto-param-match
Naming Restrictions (Section 9.3)
Declaration reuses name visible in outer scope.
m: --++
ansi-reserved
External name conflicts with name reserved for the compiler or standard library.
m: ---+
ansi-reserved-internal
Internal name conflicts with name reserved for the compiler or standard library.
plain: -
distinct-external-names
Sets the number of significant characters in an external name (ANSI default minimum is 6). Sets +distinctexternalnames.
plain: -
external-name-case-insensitive
Make alphabetic case insignificant in external names. According to ANSI standard, case need not be significant in an external name. If +distinctexternalnames is not set, sets +distinctexternalnames with unlimited external name length.
Distinct Internal Names
m: ----
distinct-internal-names
Set the number of significant characters in an internal name. Sets +distinctinternalnames.
plain: -
internal-name-case-insensitive
Set whether case is significant an internal names (-internalnamecaseinsensitive means case is significant). If +distinctinternalnames is not set, sets +distinct-internal-names with unlimited internal name length.
plain: -
internalnamelookalike
Set whether similar looking characters (e.g., "1" and "l") match in internal names.
Undefined Evaluation Order (Section 10.1)
m: -+++
evalorder
Behavior of an expression is undefined because sub-expressions contain interfering side effects that may be evaluated in any order.
m: ---+
evalorderuncon
Problematic Control Structures (Section 10.2)
Likely infinite loop is detected (Section 10.2.1).
m: --++
infloopsuncon
m: ---+
elseifcomplete
There is no final else following an else if construct (Section 10.2.5).
These is a non-empty case in a switch not followed by a break (Section 10.2.2).
A switch on an enum type is missing a case for a member of the enumerator.
m: --++
looploopbreak
m: --++
switchloopbreak
m: ---+
loopswitchbreak
m: ---+
switchswitchbreak
m: ---+
looploopcontinue
Loop and if Bodies (Section 10.2.4)
An if, while or for statement has no body (sets ifempty, whileempty and forempty.)
The body of an if, while or for statement is not a block (sets ifblock, whileblock and forblock.)
m: --++
whileempty
A while statement has no body.
m: ---+
whileblock
The body of a while statement is not a block
The body of a for statement is not a block.
The body of an if statement is not a block.
Suspicious Statements (Section 10.3)
m: -+++
unreachable
Code is not reached on any possible execution.
m: ---+
noeffectuncon
Statement involving call to unconstrained function may have no effect.
There is a path with no return in a function declared to return a non-void value.
Ignored Return Values (Section 10.3.2)
These flags control when errors are reported for function calls that do not use the return value. Casting the function call to void or declaring the called function to return /*@alt void@*/.
m: -+++
retvalbool
Return value of type bool ignored.
Return value of type int ignored.
m: ++++
retvalother
Return value of type other than bool or int ignored.
Return value ignored (Sets retvalbool, retvalint, retvalother.)
Unused Declarations (Section 10.4)
These flags control when errors are reported for declarations that are never used. The unused annotation can be used to prevent unused errors from being report for a particular declaration.
A external declaration is not used in any file.
m: -+++
enummemuse
Member of enumerator never used.
Function parameter never used.
Field of structure or union type is never used.
m: ---+
unusedspecial
Declaration in a special file (corresponding to .l or .y file) is unused.
Complete Programs (Section 10.5)
Function, variable, iterator or constant declared but never defined.
Check as partial system (sets -declundef, -exportlocal and prevents checking of macros in headers without corresponding .c files.)
Exports
m: ---+
export-local
m: --++
export-header
A declaration (other than a variable) is exported but does not appear in a header file.
m: --++
export-header-var
A variable declaration is exported but does not appear in a header file.
An unrecognized identifier is used.
plain: +
sys-unrecog
Report unrecognized identifiers that start with the system prefix, __ (two underscores).
Multiple Definition and Declarations
A function or variable is defined more than once.
An identifier is declared more than once.
m: -+++
nested-extern
An extern declaration is used inside a function body.
A function is declared without a parameter list prototype.
Function definition is in old style syntax. Standard prototype syntax is preferred.
Check for violations of standard limits (Sets controlnestdepth, stringliterallen, includenest, numstructfields, and numenummembers).
m: ---+
m: ---+
stringliterallen <number>
Set maximum length of string literals (ANSI minimum is 509).
m: ---+
numstructfields <number>
Set maximum number of fields in a struct or union (ANSI minimum is 127).
m: ---+
numenummembers <number>
Set maximum number of members of an enum type (ANSI minimum is 127).
m: --++
includenest <number>
Set maximum number of nested #include files (ANSI minimum is 8).
Header Inclusion (Apppendix F)
Report use of a POSIX header when checking a program with a non-POSIX library.
Do not include header files in system directories (as set by -sysdirs)
plain: +
sys-dir-expand-macros
m: ---+
sys-dir-errors
Report errors in files in system directories (set by -systemdirs).
Optimize header inclusion to only include each header file once.
Use library information instead of including header files.
These flags control how syntactic comments are interpreted (see Apppendix E).
plain: -
nocomments
Actual number of errors does not match number in /*@i<n>@*/
Interpret traditional lint comments (/*FALLTHROUGH*/, /*NOTREACHED*/, /*PRINTLIKE*/).
m: -+++
warnlintcomments
Print a warning and suggest an alternative when a traditional lint comment is used.
Stylized comment is unrecognized.
A line continuation marker (\) appears inside a comment on the
same line as the comment close. Preprocessors should handle this correctly, but it causes problems for some preprocessors.
plain: +
nest-comment
Support some GNU (gcc) language extensions.
A data abstraction barrier is violated.
A control flow error is detected.
Within a flag name, abbreviations may be used. Table 2 shows the flag name abbreviations. The expanded and short forms are interchangeable in flag names.
For example, globsimpmodsnothing and globalsimpliesmodifiesnothing denote the same flag. Abbreviations in flag names allow pronounceable, descriptive names to be used without making flag names excessively long (although one must admit even globsimpmodsnothing is a bit of a mouthful.)
Expanded Form | Short Form |
constant | const |
declaration | decl |
function | fcn |
global | glob |
implicit, implied | imp |
iterator | iter |
length | len |
modifies | mods |
modify | mod |
memory | mem |
parameter | param |
pointer | ptr |
return | ret |
variable | var |
unconstrained, unconst | uncon |